/**
 * 防抖
 * @param {function} callback 回调函数
 * @param {number} delay 延迟毫秒数
 * @returns {function}
 */
export default function debouncer(callback, delay = 500) {
    let timeout = 0;
    return function handler(...args) {
        clearTimeout(timeout);
        timeout = setTimeout(callback, delay, args);
    };
}
